﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class TestPayPalFlow : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        Session["unique_id"] = "1";
        string PaymentOption = "Visa";
        if (PaymentOption == "Visa" || PaymentOption == "MasterCard" || PaymentOption == "Amex" || PaymentOption == "Discover")
        {
            NVPAPICaller test = new NVPAPICaller();

         string    creditCardType = "Visa"; // Set this to one of the acceptable values (Visa/MasterCard/Amex/Discover) match it to what was selected on your Billing page
         string creditCardNumber = "4557113821566791"; //  Set this to the string entered as the credit card number on the Billing page
         string expDate = "30/10/2010"; //  Set this to the credit card expiry date entered on the Billing page
         string cvv2 = "123"; //  Set this to the CVV2 string entered on the Billing page 
            string firstName = "Ranjana"; //  Set this to the customer's first name that was entered on the Billing page 
            string lastName = "sharma"; //  Set this to the customer's last name that was entered on the Billing page 
            string street = "mumbai"; //  Set this to the customer's street address that was entered on the Billing page 
            string city = "mumbai"; //  Set this to the customer's city that was entered on the Billing page 
            string state = "mumbai"; //  Set this to the customer's state that was entered on the Billing page 
            string zip = "12345"; //  Set this to the zip code of the customer's address that was entered on the Billing page 
            string countryCode = "2"; //  Set this to the PayPal code for the Country of the customer's address that was entered on the Billing page 
            string currencyCode = "USD"; //  Set this to the PayPal code for the Currency used by the customer
            string orderDescription = "OrderDescription"; //  Set this to the textual description of this order 

            string paymentType = "Sale";
            string retMsg = "";
          //  string finalPaymentAmount = "10";
            NVPCodec decoder =new NVPCodec(); 

         string    finalPaymentAmount = "10";
            bool ret = test.DirectPayment(paymentType, "10", creditCardType, creditCardNumber, expDate, cvv2, firstName, lastName, street, city, state, zip, countryCode, currencyCode, orderDescription,ref decoder, ref retMsg);
         
            if (ret)
            {
                // success
            }
            else
            {
                Response.Redirect("APIError.aspx?" + retMsg);
            }
        }
    }
}
